use core::mem::{offset_of, size_of};

#[repr(C)]
pub struct PtRegs {
    regs0: u64,
    regs1: u64,
    regs2: u64,
    regs3: u64,
    regs4: u64,
    regs5: u64,
    regs6: u64,
    regs7: u64,
    regs8: u64,
    regs9: u64,
    regs10: u64,
    regs11: u64,
    regs12: u64,
    regs13: u64,
    regs14: u64,
    regs15: u64,
    regs16: u64,
    regs17: u64,
    regs18: u64,
    regs19: u64,
    regs20: u64,
    regs21: u64,
    regs22: u64,
    regs23: u64,
    regs24: u64,
    regs25: u64,
    regs26: u64,
    regs27: u64,
    regs28: u64,
    regs29: u64,
    regs30: u64,
    sp: u64,
    pc: u64,
    pstate: u64,

    orig_x0: u64,
    syscallno: i32,
    unused2: u32,
    orig_addr_limit: u64,
    unused: u64,
    stackframe: [u64; 2],
}

pub const S_LR: usize = offset_of!(PtRegs, regs30);
pub const S_SP: usize = offset_of!(PtRegs, sp);
pub const S_PC: usize = offset_of!(PtRegs, pc);
pub const S_PSTATE: usize = offset_of!(PtRegs, pstate);
pub const S_ORIG_X0: usize = offset_of!(PtRegs, orig_x0);
pub const S_ORIG_ADDR_LIMIT: usize = offset_of!(PtRegs, orig_addr_limit);
pub const S_STACKFRAME: usize = offset_of!(PtRegs, stackframe);
pub const S_SYSCALLNO: usize = offset_of!(PtRegs, syscallno);
pub const S_FRAME_SIZE: usize = size_of::<PtRegs>();
